<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!--_meta 作为公共模版分离出去--><!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
<meta http-equiv="Cache-Control" content="no-siteapp"/>
<link rel="Bookmark" href="/favicon.ico">
<link rel="Shortcut Icon" href="/favicon.ico"/>
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/static/easyUI/easyui.css">
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/static/dtree/dtree.css"/>

<title>菜单管理</title>
<meta name="keywords" content="">
<meta name="description" content="">
</head>
 <body class="easyui-layout" style="width:100%;height:100%;">
		<div id="tree" data-options="region:'west'" title="菜单模块树" style="width:20%;padding:10px">
			
		</div>
		
		<div data-options="region:'center'" title="模块菜单"  >
		     <!-- 展示当前模块下的子模块  -->
		      <iframe frameborder="0" id="sonModules"  width="100%" height="100%" ></iframe>
		</div>
</body>
<!--_footer 作为公共模版分离出去-->
<script src="${pageContext.request.contextPath}/static/js/jquery-1.11.0.min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/static/js/jquery-migrate-1.2.1.min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/static/easyUI/jquery.easyui.min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/static/dtree/dtree.js"></script>
<script type="text/javascript">
<!-- 展示所有的模块树  -->
	  $(function(){
			 refreshDtree();
		 })
			
		 //生成模块树
		 function refreshDtree(){
			 d = new dTree("d","${pageContext.request.contextPath}");
			 d.add("0",-1,"系统模块树");
			 d.add("1","0","全部","javascript:refreshRight(0)");
	 
			 //通过异步请求获取所有的模块信息，并将数据填充至dTree插件中显示
			 $.ajax({
				 type:"post",
				 url:"${pageContext.request.contextPath}/back/module/loadAllModule.do",
				 dataType:"json",
				 success:function(data){
					  $.each(data,function(){
						  if(this.id.length!=12){
						 	d.add(this.id,this.pid,this.name,this.id.length==4?"#":"javascript:refreshRight('"+this.id+"','"+this.name+"')",this.name); 
						  }
					 }); 					 
					 //将dTree树放在 id为tree的div中
					 $("#tree").html(d.toString()); 
					 //展开所有的节点
					 d.openTo("1");
				 },error:function(){
					 alert("数据加载异常！");
				 }				 				 
			 })		 			
		 }

		 //刷新页面右侧
		  function refreshRight(code,name){
			$("#sonModules").attr("src","${pageContext.request.contextPath}/back/permission/getModulesByParent.htm?name="+name+"&id="+code+"&roleId=${roleId}");
		 } 
 				
</script>
</html>